import React from 'react';
import { Carousel } from 'antd-mobile';
import { storage } from 'utils'
import router from 'umi/router';
import styles from './style.less';

const loadImgList = ['01', '02', '03'];

class Index extends React.PureComponent {
  state = {
    currentNum: 0,
  };

  afterChange = currentNum => {
    this.setState({ currentNum });
  };

  toHome = () => {
    storage.setItem('initial', true);
    console.log(22)
    router.push('/login');
  };

  render() {
    return (
      <div className={styles['loding-page']}>
        <Carousel
          afterChange={this.afterChange}
          className={styles.Carousel}
          autoplay={false}
          dots={false}
        >
          {loadImgList.map((val, index) => (
            <div key={val} className={`${styles['loading-img']} ${styles[`loading-${val}`]}`}>
              {index === loadImgList.length - 1 && (
                <div onClick={this.toHome} className={styles['btn-next']}>
                  确定
                </div>
              )}
            </div>
          ))}
        </Carousel>
      </div>
    );
  }
}

export default Index;
